package com.baoyouqun.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.Fastjson2TypeHandler;
import com.baoyouqun.domain.Enum.DemandTypeEnum;
import com.baoyouqun.domain.Enum.PhonePrivacyEnum;
import com.baoyouqun.domain.Enum.ResourceUrgencyEnum;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

@Data
@TableName(value = "demand", autoResultMap = true)
public class Demand implements Serializable {
    @Serial
    private static final long serialVersionUID = 1L;

    @TableId(type = IdType.ASSIGN_ID)
    @ApiModelProperty(value = "主键ID")
    private String id;

    @ApiModelProperty(value = "发布用户ID")
    private String userId;

    @ApiModelProperty(value = "发布类型")
    private DemandTypeEnum type;

    @ApiModelProperty(value = "展示地区（省市县拼接）")
    private String cityName;

    @ApiModelProperty(value = "地区code")
    private String cityCode;

    @ApiModelProperty(value = "标签")
    private String tag;

    @ApiModelProperty(value = "行业")
    private String industry;
    
    @ApiModelProperty(value = "需求标题")
    private String title;

    @ApiModelProperty(value = "需求描述")
    private String description;

    @ApiModelProperty(value = "附件")
    @TableField(typeHandler = Fastjson2TypeHandler.class)
    private List<String> fileList;

    @ApiModelProperty(value = "手机号隐私保护")
    private PhonePrivacyEnum phonePrivacy;

    @ApiModelProperty(value = "资源紧急程度")
    private ResourceUrgencyEnum resourceUrgency;

    @ApiModelProperty(value = "是否长期有效")
    private Boolean neverExpire;

    @ApiModelProperty(value = "过期时间")
    private LocalDateTime expireTime;

    @ApiModelProperty(value = "浏览量")
    private Integer viewCount;

    @ApiModelProperty(value = "点赞数")
    private Integer likeCount;

    @ApiModelProperty(value = "踩数")
    private Integer dislikeCount;

    @ApiModelProperty(value = "收藏数")
    private Integer collectCount;

    @ApiModelProperty(value = "浏览用户")
    @TableField(typeHandler = Fastjson2TypeHandler.class)
    private List<String> viewUserIds;


    @ApiModelProperty(value = "状态（0-隐藏，1-正常，2-删除，-1下架）")
    private Byte status;

    private Boolean statusByBack;

    @ApiModelProperty(value = "发布时间")
    private LocalDateTime createTime;

    @ApiModelProperty(value = "刷新时间")
    private LocalDateTime refreshTime;
    /**
     * 关联用户表的“发布人名称”（非数据库字段，仅用于查询返回）
     */
    @TableField(exist = false)
    @ApiModelProperty(value = "发布人名称（关联用户表）")
    private transient String publisherName;
}